package service;

import ThreadService.ServerThread;

import java.io.IOException;
import java.net.ServerSocket;
import java.net.Socket;

public class ServiceSocket {

    public static void main(String[] args) {
        //创建一个ServiceSocket，监听8090
        try(ServerSocket serviceSocket = new ServerSocket(8090)){
            Socket socket = null;
            while (true) {
                //接收连接，如果没有连接，accept()方法阻塞
                socket = serviceSocket.accept();
                new Thread(new ServerThread(socket)).start();
            }
        }catch (IOException e) {
            e.printStackTrace();
        }
    }
}
